<template>
	<view class="cu-bar tabbar bg-white page-bar">
		<view class="action" :class="pageIndex==0?'text-green':'text-gray'" @tap="pageJump(0)">
			<view class="cuIcon-homefill"></view> 首页
		</view>
		<view class="action" :class="pageIndex==1?'text-green':'text-gray'" @tap="pageJump(1)">
			<view class="cuIcon-similar"></view> 直播
		</view>
		<view class="action add-action" :class="pageIndex==4?'text-green':'text-gray'" @tap="pageJump(4)">
			<button class="cu-btn cuIcon-add bg-green shadow"></button>
			发布
		</view>
		<view class="action" :class="pageIndex==2?'text-green':'text-gray'" @tap="pageJump(2)">
			<view class="cuIcon-cart">
				<view class="cu-tag badge">9</view>
			</view>
			周边
		</view>
		<view class="action" :class="pageIndex==3?'text-green':'text-gray'" @tap="pageJump(3)">
			<view class="cuIcon-my">
				<view class="cu-tag badge"></view>
			</view>
			我的
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return {
				pageIndex:0
			}
		},
		methods:{
			pageJump(val){
				this.pageIndex = val
				this.$emit('jump',val)
				if(val===4){
					uni.redirectTo({
					   url: '/pages/loginOrRegise/loginOrRegise'
					})
				}
			}
		}
	}
</script>

<style>
	.page-bar{
		width: 100%;
		position: fixed;
		bottom: 0;
		left: 0;
	}
</style>
